import { http } from "@/utils/http";
import baseUrlProxy from "@/api/baseUrlProxy";
export type VppTerminalItem = {
  id: number;
  vppUserId: number;
  termSeqNo: number;
  longitude: number;
  latitude: number;
  maxLoad: number;
  maxOutput: number;
  maxUpCap: number;
  maxDownCap: number;
  maxAdjustStep: number;
  normalAdjustSpeed: number;
  maxUpSpeed: number;
  maxDownSpeed: number;
  status: number;
  termStatus: number;
  totalRevenue: number;
  shareRevenue: number;
  totalP: number;
  totalQ: number;
  totalEnergy: number;
  equipNum: number;
  equipOnnum: number;
  name: string;
  termMaker: string;
  termIpadd: string;
  programVersion: string;
  longitudeAndLatitude: string;
  initOnlineTime: string;
  onlineTime: string;
  offlineTime: string;
  pKey: string;
  qKey: string;
  termStatusKey: string;
  contactName: string;
  contactTel: string;
  createBy: string;
  createTime: string;
  updateBy: string;
  updateTime: string;
};
export type ResultTerminalList = {
  content: VppTerminalItem[];
  totalElements: number;
};

export const getVppTerminalList = (data?: object) => {
  return http.request<ResultTerminalList>(
    "get",
    baseUrlProxy + "/api/terminal_info",
    {
      params: data
    }
  );
};
export const getTemListAll = (data?: object) => {
  return http.request<any>(
    "get",
    baseUrlProxy + "/api/terminal_info/query_all",
    {
      params: data
    }
  );
};
export const getVppTerminalDetail = id => {
  return http.request<VppTerminalItem>(
    "get",
    baseUrlProxy + "/api/terminal_info/id/" + id
  );
};
export const addVppTerminalList = (data?: object) => {
  return http.request<any>("post", baseUrlProxy + "/api/terminal_info", {
    data: data
  });
};

export const editVppTerminalList = (data?: object) => {
  return http.request<any>("put", baseUrlProxy + "/api/terminal_info", {
    data: data
  });
};

export const delVppTerminalList = (data?: object) => {
  return http.request<any>("delete", baseUrlProxy + "/api/terminal_info", {
    data: data
  });
};

export const exportVppTerminalList = (data?: object) => {
  return http.request<any>(
    "get",
    baseUrlProxy + "/api/terminal_info/download",
    { params: data },
    { responseType: "blob" }
  );
};
